const qs = (selector) => document.querySelector(selector)

const qsAll = (selector) => document.querySelectorAll(selector)

function seralizeForm(selector) {
  const obj = {}
  qsAll(`${selector} input[type=text]`).forEach(inp => {
    obj[inp.name] = inp.value
  })
  qsAll(`${selector} input[type=hidden]`).forEach(inp => {
    obj[inp.name] = inp.value
  })
  qsAll(`${selector} input[type=radio]`).forEach(checkInp => {
    if (checkInp.checked) {
      obj[checkInp.name] = checkInp.value
    }
  })
  qsAll(`${selector} select`).forEach(select => {
    obj[select.name] = select.value
  })
  return obj
}